﻿<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
    <!--_meta 作为公共模版分离出去-->
    <% layout("/common/_meta.html",{title:"修改账号"}){} %>
    <!--_meta 作为公共模版分离出去-->
</head>
<body style="background-color:#fff">
<div class="wap-container">
    <div class="panel">
        <div class="panel-body">
            <form action="${ctxPath}/user/update" method="post" class="form form-horizontal" id="form-user-update">
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3">账号：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                        ${user.username!}
                        <input type="hidden" value="${user.id}" name="id" id="id">
                    </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>姓名：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                        <input type="text" class="input-text" value="${user.name!}" placeholder="姓名" id="name" name="name">
                    </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>手机号：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                        <input type="text" class="input-text" value="${user.phone!}" placeholder="手机号" id="phone" name="phone">
                    </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3">岗位：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                        <input type="text" class="input-text" value="${user.company!}" placeholder="岗位" id="company" name="company">
                    </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3">商户：</label>
                    <div class="form-controls col-xs-8 col-sm-8">
                        <span class="select-box">
                            <select class="select" name="departmentId" size="1">
                                <%for(department in departments){%>
                                    <option value="${department.id}"
                                    <%if(department.id == user.departmentId){%>
                                    selected
                                    <%}%>
                                    >${department.name}</option>
                                <%}%>
                            </select>
                        </span>
                    </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>账号状态：</label>
                    <div class="form-controls col-xs-8 col-sm-8 skin-minimal">
                        <div class="radio-box">
                            <input name="isDisable" type="radio" id="isDisable-0" value="false"
                            <%if(user.isDisable == false){%>
                            checked
                            <%}%>
                            >
                            <label for="isDisable-0">正常</label>
                        </div>
                        <div class="radio-box">
                            <input name="isDisable" type="radio" id="isDisable-1" value="true"
                            <%if(user.isDisable == true){%>
                            checked
                            <%}%>
                            >
                            <label for="isDisable-1">停用</label>
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <label class="form-label col-xs-3 col-sm-3">角色：</label>
                    <div class="formControls col-xs-8 col-sm-8">
                        <div class="skin-minimal">
                            <%for(role in roles){%>
                            <div class="check-box">
                                <input type="checkbox" id="checkbox-${role.id}" name="roleIds" value="${role.id}"
                                <%if(array.contain(roleIds,role.id)){%>
                                checked
                                <%}%>
                                >
                                <label for="checkbox-${role.id}">${role.name} <span class="c-999">${role.description}</span></label>
                            </div><br>
                            <%}%>
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-xs-8 col-sm-8 col-xs-offset-3 col-sm-offset-3">
                        <button type="submit" class="btn btn-success btn-block radius">修改账号</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<% layout("/common/_footer.html"){} %>
<% layout("/common/_validate.html"){} %>
<!--/_footer 作为公共模版分离出去-->
<script type="text/javascript">
    $(function(){

        $("#form-user-update").validate({
            rules:{
                id: {
                    required: true
                },
                name: {
                    required: true,
                    maxlength: 32
                },
                company: {
                    maxlength: 50
                },
                phone: {
                    required: true,
                    maxlength: 11
                },
                departmentId: {
                    required: true
                },
                isDisable: {
                    required: true
                }
            },
            submitHandler:function(form){
                loading();
                form.submit();
            }
        });
    });
</script>
</body>
</html>
